// PartConnect.h: interface for the PartConnect class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PARTCONNECT_H__89A1EF24_BE82_407E_B988_F9A2A9165FC3__INCLUDED_)
#define AFX_PARTCONNECT_H__89A1EF24_BE82_407E_B988_F9A2A9165FC3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Part.h"

class DllExport PartConnect : public Part  
{
public:
	PartConnect();
	virtual ~PartConnect();

public:
	inline DOUBLE GetDiameter(){
		DOUBLE dbTemp = 0.0;
		if(GetVariableValue(_T("size2"), dbTemp))
			return dbTemp;
		return m_dbDiameter;}
	inline void SetDiameter(DOUBLE dbDiameter){
		ChangeStateInSetFunction(m_dbDiameter, dbDiameter);
		SetVariableValue(_T("size2"), dbDiameter);
		m_dbDiameter = dbDiameter;}

	inline INT GetDH(){
		INT nTemp = 0;
		if(GetVariableValue(_T("DH"), nTemp))
			return nTemp;
		return m_nDH;
	}
	inline void SetDH(INT nDH){
		SetVariableValue(_T("DH"), nDH);
		m_nDH = nDH;}

public:
	virtual BOOL Accept(ModelVisitor* pVisitor);

public:
	virtual void SetMinInsertLength(DOUBLE dbLength){
		ChangeStateInSetFunction(m_dbMinInsertLength, dbLength);
		SetVariableValue(_T("size4"), dbLength);
		m_dbMinInsertLength = dbLength;
	}

	virtual DOUBLE GetMinInsertLength(){
		DOUBLE dbTemp = 0;
		if(GetVariableValue(_T("size4"), dbTemp))
			return dbTemp;
		return m_dbMinInsertLength;
	}
	
	virtual void SetMaxInsertLength(DOUBLE dbLength){
		ChangeStateInSetFunction(m_dbMaxInsertLength, dbLength);
		SetVariableValue(_T("size5"), dbLength);
		m_dbMaxInsertLength = dbLength;
	}

	virtual DOUBLE GetMaxInsertLength(){
		DOUBLE dbTemp = 0.0;
		if(GetVariableValue(_T("size5"), dbTemp))
			return dbTemp;
		return m_dbMaxInsertLength;
	}

protected:
	double m_dbDiameter;//connect's diameter
	INT m_nDH;
	DOUBLE m_dbMinInsertLength;
	DOUBLE m_dbMaxInsertLength;
};

#endif // !defined(AFX_PARTCONNECT_H__89A1EF24_BE82_407E_B988_F9A2A9165FC3__INCLUDED_)
